import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import org.junit.Assert;
import org.junit.Test;


public class NGuessNumberTest {
    @Test
    public void generateAnswerTest(){
        NGuessNumber nGuessNumber = new NGuessNumber();
        int[] a = nGuessNumber.generateAnswer();
        List<Integer> num = Arrays.stream(a).distinct().boxed().collect(Collectors.toList());

//        System.out.println("答案数量:" + (a.length == 4 ? "检查结果正确" : "检查结果错误"));
        Assert.assertEquals("答案数量错误",a.length ,4);
//        System.out.println("重复检检测:" + (num.size() == 4 ? "检查结果正确" : "检查结果错误"));
        Assert.assertEquals("有重复值",num.size(),4);
//        System.out.println("大小检测:" + (  Arrays.stream(a).max().getAsInt() <= 9  ? "检查结果正确" : "检查结果错误"));
        Assert.assertEquals("大小检测错误",Arrays.stream(a).max().getAsInt() <= 9  ? 1 : 2,1);
//        System.out.println(Arrays.toString(a));
    }
    @Test
    public void getPlayerInputTest(){
        NGuessNumber nGuessNumber = new NGuessNumber();
        int[] a = nGuessNumber.getPlayerInput();
//        int[] a = {1,2,3,4};
        Assert.assertEquals("输入数量错误",a.length ,4);

    }




}
